﻿@{
    Layout = "~/Views/Shared/_Layout_Admin.cshtml";
    ViewBag.Title = "GetGallary";
}

<script src="../../Scripts/Data_Table/jquery.dataTables.min.js" type="text/javascript"></script>
<script type="text/javascript">

    $(document).ready(function () {
        var oTable2 = $('#GalleryTable').dataTable({

            "bServerSide": true,
            "sAjaxSource": "/Home/AjaxGetGallary",
            "bProcessing": true,
            "sPaginationType": "full_numbers",
            "aoColumns":
[
{ "sName": "ImageId", "sTitle": "ImageId", "bVisible": false, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[0]; } },
{ "sName": "Name", "sTitle": "Name", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[1]; } }, 
{"sName": "Image", "sTitle": "Image", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[2]; } },
{ "sName": "Active", "sTitle": "Active", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[3]; } },
{ "sName": "Action", "sTitle": "Action", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[4]; } },


]
        });
        oTable2 = $('#GalleryTable').dataTable();
    });

    function DeleteGalleryImage(imageId) {
        var temp = confirm('Are you sure want to delete?');
        if (temp == true) {
            $.ajax({
                type: "POST",
                url: "/Home/DeleteGalleryImage?fileName=" + imageId,
                success: function (result) {
                    var oTable2 = $('#GalleryTable').dataTable();
                    oTable2.fnDraw();
                    return false;
                }
            });
        }
    }
    function UpdateGalleryImage(imageId) {
        var checkValue = $('#CHK' + imageId).is(':checked');
        
            $.ajax({
                type: "POST",
                url: "/Home/UpdateGalleryImage?imageId=" + imageId+"&status="+checkValue,
                success: function (result) {
                    var oTable2 = $('#GalleryTable').dataTable();
                    oTable2.fnDraw();
                    return false;
                }
            });
        
    }

</script>
 <div class="grid_10">
            <div class="box round">
                <h2>Leave Requests</h2>
                <div class="block">
                    
                    <table class="data display datatable" id="GalleryTable">
					<thead>
                <tr>
                 
                     <th>
                    </th>
                    <th>
                    </th>
                    <th>
                    </th> 
                    <th>
                    </th>
                    <th>
                    </th>                    
                    
                   
                    
                </tr>
            </thead>
					
				</table>
                   

                    
                </div>
            </div>
            
        </div>
        
